<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			
			//构造函数模式 
		function Person(name,age,sex,hasbf,bfsay,say){
			this.name=name;
			this.age=age;
			this.sex=sex;
			this.hasbf=hasbf;
			this.bfsay=bfsay;
			this.say=say;
            console.log(this.name+"今年"+this.age+"岁,"+"性别:"+this.sex+this.hasbf+this.bfsay+this.say)
		}
		var person=new Person("小明",18,"男","185cm","爱打球","能灌篮")
		//工厂模式
		 function CreatCar(name,time,product,price,specification){
		 	var Car=new Object();
		 	Car.name=name;
		 	Car.time=time;
		 	Car.product=product;
		 	Car.price=price;
		 	Car.specification=specification;
		 	Car.sayName=function(){
		 		console.log(this.name+"出厂时间："+this.time+"合格证："+this.product+"价格："+this.price+"说明："+this.specification)
		 	}
		 	return Car;
		 }
		
		 var car=CreatCar("GTR","2017.7.25","合格","1520000","如果有GTR却不炸街,那么将毫无意义")
		 car.sayName()
		
		</script>
	</body>
</html>
